/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package imageprocessing;

import com.azon.ip.utils.ImageHelper;
import com.azon.ip.utils.ImageReader;
import com.azon.ip.utils.ImageWriter;
import java.awt.image.BufferedImage;
import java.io.IOException;

/**
 *
 * @author Ahmad Fauzan
 */
public class ImageProcessing {
    
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        // TODO code application logic here
/*        String path = "image\\foto_test_1.jpg";

        int[][] matrix = ImageReader.ReadImageAsGrayScale(path);
       
        
        Transformation t = new DifferenceFunction();
        int[][] new_matrix = t.doTransform(matrix) ;
         
        BufferedImage new_img = ImageWriter.writeImageGrayScale(new_matrix);
        ImageWriter.WriteImage(new_img, "DifferenceFunction.jpg"); */
        
        
        String path = "image\\angka\\2.jpg";
        
        //WetLeftHand wet = new WetLeftHand();
        
        int[][] matrix_grayscale        = ImageReader.ReadImageAsGrayScale(path);
        
        int[][] new_matrix_grayscale = ImageHelper.cropMatrix(matrix_grayscale, 200, 200, 200, 200);
        
        BufferedImage img = ImageWriter.writeImageGrayScale(new_matrix_grayscale);
        ImageWriter.WriteImage(img, "Crop.jpg");
        
        /*String[]    chain_codes = wet.doWetLeftHand(matrix_blackandwhite);
        String      shape       = wet.guessObject(chain_codes[4]);
        
        System.out.println(shape);*/
        
        
        /*
        System.out.println("Ditemukan " + chain_codes.length + " benda!");
        
        for (int i = 0; i < chain_codes.length; i++) {
            System.out.println("Chain code ke-" + (i+1) + " = " + chain_codes[i]);
        }
        
        
        String path = "image\\foto_test_1.jpg";
        
        EdgeDetection ed = new KirschEdgeDetection();
        
        int[][] grayscale_matrix = ImageReader.ReadImageAsGrayScale(path);
        int[][] new_matrix = ed.detect(grayscale_matrix);
        
        BufferedImage new_image = ImageWriter.writeImageGrayScale(new_matrix);
        ImageWriter.WriteImage(new_image, "Kirsch.jpg"); */

    }
}
